<template>
    <el-container>
        <el-header>
            header
           
        </el-header>
        <el-container>
            <el-aside width="200px">
                <!--树状菜单-->
                <!-- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree> -->

                <!--navmenu菜单-->
                <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
                    background-color="#545c64" router text-color="#fff" active-text-color="#ffd04b">
                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>商品管理</span>
                        </template>
                        <el-menu-item index="/product/category/list">分类列表</el-menu-item>
                        <el-menu-item index="/product/list">商品列表</el-menu-item>
                    </el-submenu>
                    <el-submenu index="2">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>订单管理</span>
                        </template>
                        <el-menu-item index="/order/list">订单列表</el-menu-item>
                        <el-menu-item index="/order/list2">订单列表2</el-menu-item>
                        <el-menu-item index="/asynle/echarts">统计分析</el-menu-item>
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-main>
                <router-view />
            </el-main>
        </el-container>
    </el-container>
</template>


<script>
export default {
    data() {
        return {
            data: [{
                label: '商品管理',
                children: [{
                    label: '商品列表',
                    route: '/product/list'

                }]
            }, {
                label: '一级 2',
                children: [{
                    label: '二级 2-1',
                    children: [{
                        label: '三级 2-1-1'
                    }]
                }, {
                    label: '二级 2-2',
                    children: [{
                        label: '三级 2-2-1'
                    }]
                }]
            }, {
                label: '一级 3',
                children: [{
                    label: '二级 3-1',
                    children: [{
                        label: '三级 3-1-1'
                    }]
                }, {
                    label: '二级 3-2',
                    children: [{
                        label: '三级 3-2-1'
                    }]
                }]
            }],
            defaultProps: {
                children: 'children',
                label: 'label'
            }
        }
    },
    mounted(){
        // let user = this.$cookies.get('2103a_ph4_login_info')
        // if(user == null){
        //     //表示没有从缓存中获取登录的用户信息，即未登录
        //     this.$router.push('/login')
        // }
    },
    methods: {
        eventclick(){
            this.$message.info('sadfsfggfdsa')
        },
        handleNodeClick(data) {
            console.log('树菜单的单击事件：', data);
            if (data.route != undefined) {
                this.$router.push(data.route)
            }
        },
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        }
    }
}
</script>



<style>
.el-container {
    height: 100%;
}

.el-header,
.el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
}

.el-aside {
    /* background-color: #D3DCE6; */
    background-color: rgb(84, 92, 100);
    color: #333;
    text-align: center;
    line-height: 200px;
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    /* line-height: 160px; */
}

body>.el-container {
    margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
    line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
    line-height: 320px;
}
</style>